package com.musicdaze.utils;

/**
 * This class represents a property that has a measurable value and is
 * resettable.
 * @author mfujihara
 * 
 */
public class Property<T> implements Resettable {
  /** the nested property */
  private Value<T> property;

  /**
   * Constructs a Property with the given start value.
   * @param value the start value for this property.
   */
  public Property(T value) {
    property = new Value<T>(value);
  }

  /**
   * Gets the current value for this property
   * @return the property value
   */
  public T getValue() {
    return property.getCurrentValue();
  }

  /**
   * Sets the value of the property
   * @param value the value to set as the new value for this property
   */
  public void setValue(T value) {
    property.setValue(value);
  }

  /** {@inheritDoc} */
  @Override
  public void reset() {
    property.reset();
  }

  /** {@inheritDoc} */
  @Override
  public boolean equals(Object obj) {
    if (obj instanceof Property) {
      Property p = (Property) obj;
      return p.property.equals(this.property);
    }
    return false;
  }

  /** {@inheritDoc} */
  @Override
  public int hashCode() {
    return property.hashCode();
  }

}
